@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'I_MENU'
@Metadata.ignorePropagatedAnnotations: true
define view entity YPSM0010_I_MENU
  as select from ypsm0010_dt_menu

  association         to parent YPSM0010_I_FORM as _PForm      on  $projection.FormId = _PForm.FormId
  
  association of many to one YPSM0010_I_MENU    as _ParentMenu on  $projection.FormId     = _ParentMenu.FormId
                                                               and $projection.ParentMenu = _ParentMenu.MenuId

  association of one  to many YPSM0010_I_MENU   as _Menu       on  $projection.FormId = _Menu.FormId
                                                               and $projection.MenuId = _Menu.ParentMenu
{
  key form_id               as FormId,
  key menu_id               as MenuId,
      parent_menu           as ParentMenu,
      menu_name             as MenuName,
      menu_seq              as MenuSeq,
      create_date           as CreateDate,
      create_by             as CreateBy,
      local_last_changed_by as LocalLastChangedBy,
      local_last_changed_at as LocalLastChangedAt,
      last_changed_at       as LastChangedAt,
      _Menu,
      _ParentMenu,
      _PForm
}
